namespace Agro.Models
{
    using System;
    using SN.Data;


    /// <summary>
    /// 表名：T_UserAction 主键列：UserActionID
    /// </summary>
    [SerializableAttribute()]
    public partial class T_UserAction : Entity
    {

        protected Int32 _UserActionID;

        protected Int32 _UserID;

        protected Int32 _ActionID;

        /// <summary>
        /// 用户操作权限ID
        /// </summary>
        public Int32 UserActionID
        {
            get
            {
                return this._UserActionID;
            }
            set
            {
                this.OnPropertyValueChange(_.UserActionID, _UserActionID, value);
                this._UserActionID = value;
            }
        }

        /// <summary>
        /// 用户ID
        /// </summary>
        public Int32 UserID
        {
            get
            {
                return this._UserID;
            }
            set
            {
                this.OnPropertyValueChange(_.UserID, _UserID, value);
                this._UserID = value;
            }
        }

        /// <summary>
        /// 功能权限ID
        /// </summary>
        public Int32 ActionID
        {
            get
            {
                return this._ActionID;
            }
            set
            {
                this.OnPropertyValueChange(_.ActionID, _ActionID, value);
                this._ActionID = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<T_UserAction>("T_UserAction");
        }

        /// <summary>
        /// 获取实体中的标识列
        /// </summary>
        protected override Field GetIdentityField()
        {
            return _.UserActionID;
        }

        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        protected override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
                        _.UserActionID};
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.UserActionID,
                        _.UserID,
                        _.ActionID};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._UserActionID,
                        this._UserID,
                        this._ActionID};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.UserActionID)))
            {
                this._UserActionID = reader.GetInt32(_.UserActionID);
            }
            if ((false == reader.IsDBNull(_.UserID)))
            {
                this._UserID = reader.GetInt32(_.UserID);
            }
            if ((false == reader.IsDBNull(_.ActionID)))
            {
                this._ActionID = reader.GetInt32(_.ActionID);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(T_UserAction).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<T_UserAction>();

            /// <summary>
            /// 用户操作权限ID - 字段名：UserActionID - 数据类型：Int32
            /// </summary>
            public static Field UserActionID = new Field<T_UserAction>("UserActionID");

            /// <summary>
            /// 用户ID - 字段名：UserID - 数据类型：Int32
            /// </summary>
            public static Field UserID = new Field<T_UserAction>("UserID");

            /// <summary>
            /// 功能权限ID - 字段名：ActionID - 数据类型：Int32
            /// </summary>
            public static Field ActionID = new Field<T_UserAction>("ActionID");
        }
    }
}
